package com.wanmait.employment.manageController;


import com.auth0.jwt.exceptions.JWTVerificationException;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


//@ControllerAdvice
@RestControllerAdvice
public class CommonControllerAdvice {

    @ExceptionHandler(Exception.class)
    public AjaxResult processException(Exception e){
        return AjaxResult.error(e.getMessage());
    }
    @ExceptionHandler(JWTVerificationException.class)
    public AjaxResult processJWTVerificationException(JWTVerificationException e){
        return AjaxResult.error(10002,e.getMessage());
    }
}
